package br.com.ilhasoft.support.validation.validator;

import br.com.ilhasoft.support.validation.rule.ConfirmPasswordRule;
import br.com.ilhasoft.support.validation.rule.Rule;
import ohos.agp.components.Text;

/**
 * 密码验证
 */
public class PasswordValidator {
    /**
     * 密码验证
     * @param view view
     * @param view1 view1
     * @param value1 value1
     * @param value2 value2
     * @param errorMessage errorMessage
     * @param autoDismiss autoDismiss
     * @return true or false
     */
    public static boolean bindingPassword(Text view, Text view1, String value1,  String value2,
        String errorMessage, boolean autoDismiss) {
        boolean status;
        if (value1.trim().equals(value2.trim())){
            status = true;
        }else{
            status = false;
        }
        Rule rule = new ConfirmPasswordRule(view, view1 ,  status, errorMessage);
        return rule.validate();
    }

}
